﻿using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace AssetTrackDemo
{
    public partial class AddAsset : Form
    {
        public string TID;
        public AddAsset()
        {
            InitializeComponent();
        }

        private void AddAsset_Load(object sender, EventArgs e)
        {
            txtAssetID.Text = TID;
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtAssetName.Text.Length > 0)
                {
                    DataHelper.InsertMaterial(txtAssetName.Text, txtAssetID.Text);
                    MessageBox.Show("Asset Added");
                    this.Close();
                }
                else
                    MessageBox.Show("Please enter Asset Name.");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Error Adding Asset");
            }
        }
    }
}